/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;

import core.Authorization;
import core.User;
import javax.swing.JFrame;

/**
 *
 * @author Kuchcik
 */
enum Status{
    Admin(1),
    Medyk(2),
    Pacjent(3),
    Prezes(4),
    Praktykant(5);
    int status;
    Status(int status)
    {
        this.status = status;
    }
}

public class Menu extends javax.swing.JFrame {
    
    private static JFrame LoginFrame;
    private static User user;
    /**
     * Creates new form Menu
     */
    public Menu(JFrame LoginFrame, User user) {
        initComponents();
        this.LoginFrame = LoginFrame;
        this.user=user;
        this.lLoginName.setText(user.getFirstName()+" "+user.getLastName());
    }
    
    public void setLockPanels(int status){
        switch(status){
            case 1:{
            AuthorizationTabbedPane.removeTabAt(0);
            break;
            }
            case 2:{
            AuthorizationTabbedPane.removeTabAt(1);
            break;
            }
        }
    }
    
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        AuthorizationTabbedPane = new javax.swing.JTabbedPane();
        MedicPanel = new javax.swing.JPanel();
        AdminPanel = new javax.swing.JPanel();
        AdminTabbedPane = new javax.swing.JTabbedPane();
        UsersPanel = new javax.swing.JPanel();
        VisitsPanel = new javax.swing.JPanel();
        CheckupPanel = new javax.swing.JPanel();
        GraftingsPanel = new javax.swing.JPanel();
        MedicinePanel = new javax.swing.JPanel();
        AccessoriesPanel = new javax.swing.JPanel();
        OfficesPanel = new javax.swing.JPanel();
        VaccinesPanel = new javax.swing.JPanel();
        MedicineProducersPanel = new javax.swing.JPanel();
        PrescriptionPanel = new javax.swing.JPanel();
        ControlPanel = new javax.swing.JPanel();
        lTitle = new javax.swing.JLabel();
        bLogout = new javax.swing.JButton();
        lWhoIsLogin = new javax.swing.JLabel();
        lLoginName = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Przychodnia");
        setPreferredSize(new java.awt.Dimension(800, 600));

        javax.swing.GroupLayout MedicPanelLayout = new javax.swing.GroupLayout(MedicPanel);
        MedicPanel.setLayout(MedicPanelLayout);
        MedicPanelLayout.setHorizontalGroup(
            MedicPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 639, Short.MAX_VALUE)
        );
        MedicPanelLayout.setVerticalGroup(
            MedicPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 336, Short.MAX_VALUE)
        );

        AuthorizationTabbedPane.addTab("Medyk", MedicPanel);

        javax.swing.GroupLayout UsersPanelLayout = new javax.swing.GroupLayout(UsersPanel);
        UsersPanel.setLayout(UsersPanelLayout);
        UsersPanelLayout.setHorizontalGroup(
            UsersPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 634, Short.MAX_VALUE)
        );
        UsersPanelLayout.setVerticalGroup(
            UsersPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 308, Short.MAX_VALUE)
        );

        AdminTabbedPane.addTab("Userzy", UsersPanel);

        javax.swing.GroupLayout VisitsPanelLayout = new javax.swing.GroupLayout(VisitsPanel);
        VisitsPanel.setLayout(VisitsPanelLayout);
        VisitsPanelLayout.setHorizontalGroup(
            VisitsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 634, Short.MAX_VALUE)
        );
        VisitsPanelLayout.setVerticalGroup(
            VisitsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 308, Short.MAX_VALUE)
        );

        AdminTabbedPane.addTab("Wizyty", VisitsPanel);

        javax.swing.GroupLayout CheckupPanelLayout = new javax.swing.GroupLayout(CheckupPanel);
        CheckupPanel.setLayout(CheckupPanelLayout);
        CheckupPanelLayout.setHorizontalGroup(
            CheckupPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 634, Short.MAX_VALUE)
        );
        CheckupPanelLayout.setVerticalGroup(
            CheckupPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 308, Short.MAX_VALUE)
        );

        AdminTabbedPane.addTab("Badania", CheckupPanel);

        javax.swing.GroupLayout GraftingsPanelLayout = new javax.swing.GroupLayout(GraftingsPanel);
        GraftingsPanel.setLayout(GraftingsPanelLayout);
        GraftingsPanelLayout.setHorizontalGroup(
            GraftingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 634, Short.MAX_VALUE)
        );
        GraftingsPanelLayout.setVerticalGroup(
            GraftingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 308, Short.MAX_VALUE)
        );

        AdminTabbedPane.addTab("Szczepienia", GraftingsPanel);

        javax.swing.GroupLayout MedicinePanelLayout = new javax.swing.GroupLayout(MedicinePanel);
        MedicinePanel.setLayout(MedicinePanelLayout);
        MedicinePanelLayout.setHorizontalGroup(
            MedicinePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 634, Short.MAX_VALUE)
        );
        MedicinePanelLayout.setVerticalGroup(
            MedicinePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 308, Short.MAX_VALUE)
        );

        AdminTabbedPane.addTab("Leki", MedicinePanel);

        javax.swing.GroupLayout AccessoriesPanelLayout = new javax.swing.GroupLayout(AccessoriesPanel);
        AccessoriesPanel.setLayout(AccessoriesPanelLayout);
        AccessoriesPanelLayout.setHorizontalGroup(
            AccessoriesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 634, Short.MAX_VALUE)
        );
        AccessoriesPanelLayout.setVerticalGroup(
            AccessoriesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 308, Short.MAX_VALUE)
        );

        AdminTabbedPane.addTab("Akcesoria", AccessoriesPanel);

        javax.swing.GroupLayout OfficesPanelLayout = new javax.swing.GroupLayout(OfficesPanel);
        OfficesPanel.setLayout(OfficesPanelLayout);
        OfficesPanelLayout.setHorizontalGroup(
            OfficesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 634, Short.MAX_VALUE)
        );
        OfficesPanelLayout.setVerticalGroup(
            OfficesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 308, Short.MAX_VALUE)
        );

        AdminTabbedPane.addTab("Gabinety", OfficesPanel);

        javax.swing.GroupLayout VaccinesPanelLayout = new javax.swing.GroupLayout(VaccinesPanel);
        VaccinesPanel.setLayout(VaccinesPanelLayout);
        VaccinesPanelLayout.setHorizontalGroup(
            VaccinesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 634, Short.MAX_VALUE)
        );
        VaccinesPanelLayout.setVerticalGroup(
            VaccinesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 308, Short.MAX_VALUE)
        );

        AdminTabbedPane.addTab("Szczepionki", VaccinesPanel);

        javax.swing.GroupLayout MedicineProducersPanelLayout = new javax.swing.GroupLayout(MedicineProducersPanel);
        MedicineProducersPanel.setLayout(MedicineProducersPanelLayout);
        MedicineProducersPanelLayout.setHorizontalGroup(
            MedicineProducersPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 634, Short.MAX_VALUE)
        );
        MedicineProducersPanelLayout.setVerticalGroup(
            MedicineProducersPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 308, Short.MAX_VALUE)
        );

        AdminTabbedPane.addTab("Producenci Leków", MedicineProducersPanel);

        javax.swing.GroupLayout PrescriptionPanelLayout = new javax.swing.GroupLayout(PrescriptionPanel);
        PrescriptionPanel.setLayout(PrescriptionPanelLayout);
        PrescriptionPanelLayout.setHorizontalGroup(
            PrescriptionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 634, Short.MAX_VALUE)
        );
        PrescriptionPanelLayout.setVerticalGroup(
            PrescriptionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 308, Short.MAX_VALUE)
        );

        AdminTabbedPane.addTab("Recepty", PrescriptionPanel);

        javax.swing.GroupLayout ControlPanelLayout = new javax.swing.GroupLayout(ControlPanel);
        ControlPanel.setLayout(ControlPanelLayout);
        ControlPanelLayout.setHorizontalGroup(
            ControlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 634, Short.MAX_VALUE)
        );
        ControlPanelLayout.setVerticalGroup(
            ControlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 308, Short.MAX_VALUE)
        );

        AdminTabbedPane.addTab("ControlPanel", ControlPanel);

        javax.swing.GroupLayout AdminPanelLayout = new javax.swing.GroupLayout(AdminPanel);
        AdminPanel.setLayout(AdminPanelLayout);
        AdminPanelLayout.setHorizontalGroup(
            AdminPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(AdminTabbedPane)
        );
        AdminPanelLayout.setVerticalGroup(
            AdminPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(AdminTabbedPane)
        );

        AuthorizationTabbedPane.addTab("Admin", AdminPanel);

        lTitle.setFont(new java.awt.Font("Calibri", 2, 36)); // NOI18N
        lTitle.setText("Przychodnia");

        bLogout.setText("Wyloguj");
        bLogout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bLogoutActionPerformed(evt);
            }
        });

        lWhoIsLogin.setText("Jesteś zalogowany jako:");

        lLoginName.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lLoginName.setText("Jan Kowalski");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(AuthorizationTabbedPane)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lTitle)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(lWhoIsLogin)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lLoginName, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(bLogout))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(lWhoIsLogin)
                        .addComponent(bLogout)
                        .addComponent(lLoginName))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(lTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(AuthorizationTabbedPane))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void bLogoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bLogoutActionPerformed
        // TODO add your handling code here:
        this.setVisible(false);
        LoginFrame.setVisible(true);
    }//GEN-LAST:event_bLogoutActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel AccessoriesPanel;
    private javax.swing.JPanel AdminPanel;
    private javax.swing.JTabbedPane AdminTabbedPane;
    private javax.swing.JTabbedPane AuthorizationTabbedPane;
    private javax.swing.JPanel CheckupPanel;
    private javax.swing.JPanel ControlPanel;
    private javax.swing.JPanel GraftingsPanel;
    private javax.swing.JPanel MedicPanel;
    private javax.swing.JPanel MedicinePanel;
    private javax.swing.JPanel MedicineProducersPanel;
    private javax.swing.JPanel OfficesPanel;
    private javax.swing.JPanel PrescriptionPanel;
    private javax.swing.JPanel UsersPanel;
    private javax.swing.JPanel VaccinesPanel;
    private javax.swing.JPanel VisitsPanel;
    private javax.swing.JButton bLogout;
    private javax.swing.JLabel lLoginName;
    private javax.swing.JLabel lTitle;
    private javax.swing.JLabel lWhoIsLogin;
    // End of variables declaration//GEN-END:variables
}
